#include <iostream>
#include "Fraction.h"

using namespace std;

int main() {
    // 测试用例
    Fraction f1(6, 8);
    Fraction f2(4, -6);
    Fraction f3 = f1 + f2;
    Fraction f4 = f1 - f2;
    Fraction f5 = f1 * f2;
    Fraction f6 = f1 / f2;

    cout << "f1: " << f1 << endl;
    cout << "f2: " << f2 << endl;
    cout << "f1 + f2: " << f3 << endl;
    cout << "f1 - f2: " << f4 << endl;
    cout << "f1 * f2: " << f5 << endl;
    cout << "f1 / f2: " << f6 << endl;

    cout << "f1 < f2: " << (f1 < f2) << endl;
    cout << "f1 <= f2: " << (f1 <= f2) << endl;
    cout << "f1 == f2: " << (f1 == f2) << endl;
    cout << "f1 != f2: " << (f1 != f2) << endl;
    cout << "f1 >= f2: " << (f1 >= f2) << endl;
    cout << "f1 > f2: " << (f1 > f2) << endl;

    // 转换为 double 类型
    double value = static_cast<double>(f1);
    cout << "f1 转换为 double 类型: " << value << endl;

    // 从有限小数字符串进行转换
    Fraction f7 = Fraction::fromDec(0.125);
    cout << "从小数 0.125 转换得到的分数: " << f7 << endl;

    // 测试流插入和提取器
    Fraction f8;
    cout << "请输入一个分数（分子/分母）：";
    cin >> f8;
    cout << "您输入的分数是：" << f8 << endl;

    return 0;
}
